/********************************************/
  // Creation History
  // --------------------------------------------------------------
  //	Company:			HTHK
  //	NAME:				Employee.java
  //    Title   :			get the Employee Data into a list box
  //	FUNCTION:
  //	BY:					Beyes Xia
  //	DATE:				16/12/2003
  // --------------------------------------------------------------
/*********************************************/
// Copyright (c) 2002 HTHK
package tss.staffproject;

import com.ffpc.sql.*;

import tss.staffproject.EmployeeBean;

public class Employee
   extends DataObject
   implements EmployeeBean
{
   private String staff_no = null;
   private String surname = null;
   private String first_name = null;
   private String alias = null;
   private String join_date = null;
   private String last_date = null;
   private String department_code = null;
   private String cost_center = null;
   private String position = null;
   private String employment_type = null;
   private String import_dt = null;
   private Column ColStaffNo = null;
   private Column ColSurname = null;
   private Column ColFirstName = null;
   private Column ColAlias = null;
   private Column ColJoinDate = null;
   private Column ColLastDate = null;
   private Column ColDepartmentCode = null;
   private Column ColCostCenter = null;
   private Column ColPosition = null;
   private Column ColEmploymentType = null;
   private Column ColImportDt = null;
   /**
    * Constructor
    */
   public Employee()
   {
       ColStaffNo = new Column(0,"staff_no",Column.Types.string,null,5,false);
       ColSurname = new Column(1,"surname",Column.Types.string,null,20,false);
       ColFirstName = new Column(2,"first_name",Column.Types.string,null,30,false);
       ColAlias = new Column(3,"alias",Column.Types.string,null,15,true);
       ColJoinDate = new Column(4,"join_date",Column.Types.time,null,7,false);
       ColLastDate = new Column(5,"last_date",Column.Types.time,null,7,true);
       ColDepartmentCode = new Column(6,"department_code",Column.Types.string,null,5,true);
       ColCostCenter = new Column(7,"cost_center",Column.Types.string,null,5,false);
       ColPosition = new Column(8,"position",Column.Types.string,null,50,true);
       ColEmploymentType = new Column(9,"employment_type",Column.Types.string,null,5,false);
       ColImportDt = new Column(10,"import_dt",Column.Types.time,null,7,false);
   }

   // functions belongs to EmployeeBean interface

   @Override
public void setStaff_no(String staff_no)
   {       this.staff_no = this.setAttribute(ColStaffNo,staff_no);
   }

   @Override
public String getStaff_no()
   {       return this.staff_no==null?"":this.staff_no;
   }

   @Override
public void setSurname(String surname)
   {       this.surname = this.setAttribute(ColSurname,surname);
   }

   @Override
public String getSurname()
   {       return this.surname==null?"":this.surname;
   }

   @Override
public void setFirst_name(String first_name)
   {       this.first_name = this.setAttribute(ColFirstName,first_name);
   }

   @Override
public String getFirst_name()
   {       return this.first_name==null?"":this.first_name;
   }

   @Override
public void setAlias(String alias)
   {       this.alias = this.setAttribute(ColAlias,alias);
   }

   @Override
public String getAlias()
   {       return this.alias==null?"":this.alias;
   }

   @Override
public void setJoin_date(String join_date)
   {       this.join_date = this.setAttribute(ColJoinDate,join_date);
   }

   @Override
public String getJoin_date()
   {       return this.join_date==null?"":this.join_date;
   }

   @Override
public void setLast_date(String last_date)
   {       this.last_date = this.setAttribute(ColLastDate,last_date);
   }

   @Override
public String getLast_date()
   {       return this.last_date==null?"":this.last_date;
   }

   @Override
public void setDepartment_code(String department_code)
   {       this.department_code = this.setAttribute(ColDepartmentCode,department_code);
   }

   @Override
public String getDepartment_code()
   {       return this.department_code==null?"":this.department_code;
   }

   @Override
public void setCost_center(String cost_center)
   {       this.cost_center = this.setAttribute(ColCostCenter,cost_center);
   }

   @Override
public String getCost_center()
   {       return this.cost_center==null?"":this.cost_center;
   }

   @Override
public void setPosition(String position)
   {       this.position = this.setAttribute(ColPosition,position);
   }

   @Override
public String getPosition()
   {       return this.position==null?"":this.position;
   }

   @Override
public void setEmployment_type(String employment_type)
   {       this.employment_type = this.setAttribute(ColEmploymentType,employment_type);
   }

   @Override
public String getEmployment_type()
   {       return this.employment_type==null?"":this.employment_type;
   }

   @Override
public void setImport_dt(String import_dt)
   {       this.import_dt = this.setAttribute(ColImportDt,import_dt);
   }

   @Override
public String getImport_dt()
   {       return this.import_dt==null?"":this.import_dt;
   }

   // belongs to row interface

   @Override
public Column[] createColumns()
   {
       Column[] cols = new Column[11];
       cols[0] = ColStaffNo.clone(null);
       cols[1] = ColSurname.clone(null);
       cols[2] = ColFirstName.clone(null);
       cols[3] = ColAlias.clone(null);
       cols[4] = ColJoinDate.clone(null);
       cols[5] = ColLastDate.clone(null);
       cols[6] = ColDepartmentCode.clone(null);
       cols[7] = ColCostCenter.clone(null);
       cols[8] = ColPosition.clone(null);
       cols[9] = ColEmploymentType.clone(null);
       cols[10] = ColImportDt.clone(null);
       return cols;
   }

   // super's abstract methods

   @Override
public String getTableName()
   {
       return "tss.tss_c_employee";
   }

   @Override
protected String[] getKeyColumnNames()
   {
       String[] list = {
                         "staff_no"
                       };
       return list;
   }

   @Override
protected String[] getUpdatableColumnNames()
   {
       String[] list = {
                         "surname"
                         ,"first_name"
                         ,"alias"
                         ,"join_date"
                         ,"last_date"
                         ,"department_code"
                         ,"cost_center"
                         ,"position"
                         ,"employment_type"
                         ,"import_dt"
                       };
       return list;
   }

   @Override
protected void retrieveColumnValues()
   {
       this.staff_no = this.retrieveColumnValue("staff_no");
       this.surname = this.retrieveColumnValue("surname");
       this.first_name = this.retrieveColumnValue("first_name");
       this.alias = this.retrieveColumnValue("alias");
       this.join_date = this.retrieveColumnValue("join_date");
       this.last_date = this.retrieveColumnValue("last_date");
       this.department_code = this.retrieveColumnValue("department_code");
       this.cost_center = this.retrieveColumnValue("cost_center");
       this.position = this.retrieveColumnValue("position");
       this.employment_type = this.retrieveColumnValue("employment_type");
       this.import_dt = this.retrieveColumnValue("import_dt");
   }
}

